<?php 
//引进配置信息
include '../include/init.php';
//引入数据库配置信息
include '../include/mysql.config.php';
//引入公共函数
include '../include/common.fun.php';
islogin();
if($_GET){
	$id=isset($_GET['id'])?$_GET['id']+0:0;
	$sql="SELECT * from wd_link where link_id=$id";
	$link=$db->getOne($sql);
}



if ($_POST){
	$title=$_POST['title'];
	$author=$_POST['author'];
	$content=$_POST['content'];
	$id=$_POST['id'];

	

	$date=array(
			'link_name' => $title,
			'link_addtime' => time(),
			'link_url' => $content,
			'link_cat_id'=>$linkCatId
		);
	
	$where = 'link_id='.$id;
	$res = $db->update('wd_link',$date,$where);
	if($res){
		alert('更新成功','link_list.php');
	}else{
		alert('更新失败');
	}
}


include 'view/link_edit.php';